float4x4 WVP;
float3x3 World;

float4 Color;

struct VSInput
{
	float4 Position : POSITION0;
	float3 Normal : NORMAL0;
};

struct VSOutput
{
	float4 Position : POSITION0;
	float3 Normal : NORMAL;
	float2 Depth : TEXCOORD3;
};

struct PSInput
{
	float3 Normal : NORMAL;
	float2 Depth : TEXCOORD3;
};

struct PSOutput
{
	float4 Color : COLOR0;
	float4 Normal : COLOR1;
	float4 Depth : COLOR2;
};

VSOutput VSFunction(VSInput input)
{
	VSOutput output;

	output.Position = mul(input.Position, WVP);

	output.Normal = mul(input.Normal, World);

	output.Depth.xy = output.Position.zw;
  
	return output;
}

PSOutput PSFunction(PSInput input)
{
	PSOutput ret;
	ret.Color = Color;
	ret.Normal = normalize(float4(input.Normal, 1))/2 + float4(0.5, 0.5, 0.5, 0.5);
	float depth = input.Depth.x / input.Depth.y;
	ret.Depth = float4(depth, 0, 0, 0);
	return ret;
}

technique StaticMap
{
	pass StaticMap
	{
		VertexShader = compile vs_3_0 VSFunction();
		PixelShader = compile ps_3_0 PSFunction();
	}
}